package com.app.qbake.module.mine;

import android.support.v4.app.Fragment;

import com.wind.base.mvp.view.TabLayoutFragment;
import com.wind.data.mine.OrderListRequest;
import com.app.qbake.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by wind on 2018/10/20.
 */

public class BuyedGoodsTabFragment extends TabLayoutFragment {


    @Override
    public int getLayoutRes() {
        return R.layout.fragment_my_goods_tab;
    }

    @Override
    public List<String> getTitles() {
        List<String> titles=new ArrayList<>();
        titles.add("全部");
        titles.add("待付款");
        titles.add("已付款");
        titles.add("待收货");
        return titles;
    }

    @Override
    protected List<Fragment> getFragments() {
        List<Fragment> fragments=new ArrayList<>();
        fragments.add(OrderListFragment.getInstance(OrderListRequest.TYPE_BUY,OrderListRequest.STATUS_ALL,-1));
        fragments.add(OrderListFragment.getInstance(OrderListRequest.TYPE_BUY,OrderListRequest.STATUS_PENDING_PAY,OrderListRequest.MAIL_NO));
        fragments.add(OrderListFragment.getInstance(OrderListRequest.TYPE_BUY,OrderListRequest.STATUS_PAY_SUCCESS,OrderListRequest.MAIL_NO));
        fragments.add(OrderListFragment.getInstance(OrderListRequest.TYPE_BUY,OrderListRequest.STATUS_PAY_SUCCESS,OrderListRequest.MAIL_YES));
        return fragments;
    }

    public void refresh() {
        for (int i = 0; i < mFragmentAdapter.getCount(); i++) {
            OrderListFragment f= (OrderListFragment) mFragmentAdapter.getItem(i);
            f.refresh();
        }

    }
}
